﻿using System;

namespace DelegatesAndEventsTest
{
    class DelegatesAndEventsTest
    {
        private static void Info_Change(object sender, EventArgs eventArgs)
        {
            Console.WriteLine("Info_Change() event called.");
        }

        private static void Property_Change(object sender, PropertyChangedEventArgs eventArgs)
        {
            Console.WriteLine("{0} property value changed from {1} to {2}",
                              eventArgs.PropertyChange, eventArgs.OldValue, eventArgs.NewValue);
        }

        static void Main(string[] args)
        {
            //Person person = new Person();
            //person.InfoChange += new EventHandler(Info_Change);
            //person.FirstName = "Petar";
            //person.FirstName = "Georgi";
            AnotherPerson anotherPerson = new AnotherPerson();
            anotherPerson.PropertyChanged += new PropertyChangedEventHandler(Property_Change);
            anotherPerson.LastName = "Ivanov";
        }
    }
}